<?php

function smarty_function_recaptcha( $p )
{
	$r = array(
		'theme' => 'white',
		'lang' => 'ru',
		);
	
	$p += $r;
	
	if( isset( $p['widget'] ) )
	{
		$p['custom_theme_widget'] = $p['widget'];
		unset( $p['widget'] );
	}
	
	return sprintf( "<script>var RecaptchaOptions=%s;</script>%s", json::encode( $p ), recaptcha::getHtml() );
}
